# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: speps <speps at aur dot archlinux dot org>
# Contributor: DrZaius <lou[at]fakeoutdoorsman.com>

pkgname=libltc
pkgver=1.3.2
pkgrel=1
pkgdesc="Linear/Logitudinal Time Code (LTC) Library"
arch=(loong64 x86_64)
url="https://x42.github.io/libltc/"
license=(GPL3)
depends=(glibc)
makedepends=(doxygen)
provides=(libltc.so)
options=(debug)
source=(https://github.com/x42/$pkgname/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz)
sha512sums=('3b29b7da1ad9f85c62068b927abec9b3963a77558b46b3ee7681f360642570935becedcf95436574a8a7b456c7e0b414131571d71c6903139f9e7565968278a6')
b2sums=('8a6b3452245f72e918b4a105854d751ca66780ce4627aca54bb0d1342c5a1e77e614103da15037f71b89d44c62b35230a6240e42af287c442e6049c2ad9c85a6')

prepare() {
  cd $pkgname-$pkgver
  autoreconf -fiv
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr
  make
  doxygen
}

check(){
  # tests can not run with parallel jobs: https://github.com/x42/libltc/issues/66
  make check -j1 -C $pkgname-$pkgver
}

package() {
  make DESTDIR="$pkgdir/" install -C $pkgname-$pkgver
  install -vDm 644 $pkgname-$pkgver/{AUTHORS,ChangeLog,README.md} -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 $pkgname-$pkgver/doc/html/*.{css,html,js,png} -t "$pkgdir/usr/share/doc/$pkgname/html/"
}
